#include "gd32f30x.h"
#include "stdio.h"

#include "DevicesFlash.h"

#include "version.h"


/* 固件地址存储 APP 版本信息 */
const char cVersionHardBuff[32] __attribute__ ((section(".ARM.__at_0x08000800"))) = VERSION_HARD;
const char cVersionSoftBuff[32] __attribute__ ((section(".ARM.__at_0x08000820"))) = VERSION_SOFT;
const char cVersionDateBuff[32] __attribute__ ((section(".ARM.__at_0x08000840"))) = __DATE__" - "__TIME__;


/* 获取 Boot 版本信息 */
char *pcVersionBootloaderHardGet(void)
{
    return (char *)(FLASH_BOOTLOADER_ADDR + 0x800);
}

char *pcVersionBootloaderSoftGet(void)
{
    return (char *)(FLASH_BOOTLOADER_ADDR + 0x820);
}

char *pcVersionBootloaderDateGet(void)
{
    return (char *)(FLASH_BOOTLOADER_ADDR + 0x840);
}


/* 获取 APP 版本信息 */
char *pcVersionAPPHardGet(void)
{
    return (char *)(FLASH_APP_ADDR + 0x800);
}

char *pcVersionAPPSoftGet(void)
{
    return (char *)(FLASH_APP_ADDR + 0x820);
}

char *pcVersionAPPDateGet(void)
{
    return (char *)(FLASH_APP_ADDR + 0x840);
}
